import os, sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from sqlist import SqList

def Reverse(sq):#O(n)，O(1)
    """Reverse sequential list"""
    for i in range(sq.size // 2):
        sq.data[i], sq.data[sq.size - i - 1] = sq.data[sq.size - i - 1], sq.data[i]

if __name__ == "__main__":
    # Create sequential list instance
    sq = SqList()
    sq.CreateList([1, 2, 3, 4, 5])
    # Test inversion
    Reverse(sq)
    print(sq.display())
    